home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / ebl407px.zip / BATDOC2.BAT < prev    next >
DOS Batch File  |  1992-01-15  |  52KB  |  1,365 lines

  1. bat * Loading HELP and DOCUMENTATION part 2
  2.  
  3. *           Written by F.Canova 10/5/83 through 01/15/92
  4. *   (c) Copyright 1983 to 1992 by Seaware Corp. all rights reserved.
  5. *    This batch file REQUIRES EBL PLUS for proper execution!
  6.  
  7.          **** NOTE! NOTE! NOTE! NOTE! ****
  8.  RAM    |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
  9.  
  10.  if %G = .goto. then %G = | goto -%F
  11.  beep type Error! Begin by using BATDOC first!
  12.  type This file is an overlay to BATDOC.
  13.  exit
  14.  
  15. -opt0     %F = opt0     | skip 3
  16. -line0     %F = line0    | skip 2
  17. -line599  %F = line599 | skip 1
  18. -line1404 %F = line1404
  19.     %G = .goto.
  20.     color 8f |type Loading part 1 ...
  21.     leave
  22.     batdoc
  23.  
  24. -header * Routine prints general purpose header for help text
  25.     stack.purge            |*  remove any pre-typed keystrokes.
  26.     %n = %i $ 1 ( %i # - 2 ) & . & ( %i $ ( %i # - 1 ) 2 ) |* extract section # from page #
  27.     color( white on black )
  28.     cls
  29.     color( white on cyan  )
  30.     window( 1, 1, 79, 3, Combo)
  31.     begtype
  32.  \%H                     Page \%n
  33.  
  34. \07    Press:  PGDN for next page,   PGUP for prev page,  HOME for main menu.
  35. end
  36.     color( white on black)
  37.     colorchar ~ as color(yellow on black)
  38.     window( 1, 5, 79, 25, Combo)
  39.     return
  40.  
  41. -scroll * Routine accepts key for scrolling help text
  42.     %e = 0
  43.     inkey %k
  44.     if %k = KEY("Ctrl-C") then goto -opt0
  45.     if %k = KEY(Esc)  %i = 0      | goto -line0
  46.     if %k = KEY(Home) %i = 0      | goto -line0
  47.     if %k = KEY(Pgup) %i = %i - 1 | cls | %F = line%i | goto -%F
  48.     if %k = KEY(Pgdn) %i = %i + 1 | cls | %F = line%i | goto -%F
  49.     goto -scroll |* ignore any other key.
  50.  
  51.     * ROUTINE TO HAVE USER GIVE A COMMAND A TRY !!
  52.     * %A = string which must match
  53. -tryit
  54.     begtype
  55.  
  56.   Enter your guess!  ;
  57. end
  58. -tryit.loop
  59.     if .%a = . goto -tryit.solved.it |* end of string ?
  60.     %b = %a $ 1 1        |* get 1st letter
  61.     %a = %a $ 2        |* remove it from string
  62. -tryit.retry
  63.     inkey %k          |* get a key.
  64.     if %k = KEY(" ") type %b; | goto -tryit.loop
  65.     if %k = KEY(ESC) type %b%a| goto -tryit.give.up
  66.     if %k = %b type %k;      | goto -tryit.loop
  67.     beep goto -tryit.retry
  68.  
  69. -tryit.solved.it
  70.     begtype
  71.  
  72.  
  73. EXCELLENT !! - that's exactly it!
  74.  
  75. end
  76.     read Press the ─┘ key to continue to next section.....
  77.     return
  78.  
  79. -tryit.give.up
  80.     begtype
  81.  
  82. That's the answer you needed! (You can "peek" at part of
  83. the answer next time by pressing the space bar if you'd like.)
  84.  
  85. end
  86.     read Press the ─┘ key to continue to next section.....
  87.     return
  88.  
  89. -opt6
  90. -line503 %i = 600
  91. -line600 %H = "How to print" | call -header| begtype
  92.   The simplest thing to for Extended Batch Language to do is to print text
  93. on the display.  This is done by either of two commands, TYPE and BEGTYPE.
  94.  
  95.   The TYPE command can be used for something as simple as saying hello!
  96. For example, just put this in a batch file...
  97.  
  98.     BAT * Hello example...
  99.     TYPE "HELLO THERE"
  100.  
  101.   This is all that is needed.  This command can be typed directly from DOS
  102. (this is called immediate mode) or be entered into a file such as
  103. "TRIAL.BAT" (this is called direct execution mode).  To execute it as a BAT
  104. program with the file, just type the file's name "TRIAL" from DOS and you
  105. will see the results of the program "HELLO THERE" coming from BAT.
  106.  
  107. Note that all EBL batch programs start with the word "BAT" and an optional
  108. comment. This is always needed. For simplicity, we won't show it much in
  109. the upcoming examples, but using it is necessary to tell DOS that future
  110. commands are understood by EBL-Plus.
  111. end
  112.     goto -scroll
  113. -line601 call -header | begtype
  114.  
  115.   You can also put DOS variables into this command to display their
  116. contents.  For example, if the "TRIAL.BAT" file contained the line:
  117.  
  118.     TYPE "HELLO THERE" %1 %2
  119.  
  120.   Then when we start the BAT program from DOS, we might enter:
  121.  
  122.     TRIAL COMPUTER USER
  123.  
  124.   DOS will automatically store the words after the program name into its
  125. variables.  Therefore, in the TYPE command, we will see contents of these
  126. variables on the screen.  The resulting message would be:
  127.  
  128.     HELLO THERE COMPUTER USER
  129. end
  130.     goto -scroll
  131. -line602 call -header | begtype
  132.  
  133.   There is a second method of putting text onto the display.  This is with
  134. the BEGTYPE command.  Although it will not display the contents of
  135. variables, it is very useful for displaying large blocks of text, such as
  136. menus.    For example, if the "TRIAL.BAT" file contains:
  137.  
  138.     BAT BEGTYPE
  139.     This is a large block of text. It is useful for menus. Note
  140.     that Upper/Lower case characters are displayed intact here.
  141.     The block is always ended with "END" in the first column
  142.     after the text finishes.
  143.     END
  144.  
  145.   When executed, the "TRIAL.BAT" program will display:
  146.  
  147.     This is a large block of text. It is useful for menus. Note
  148.     that Upper/Lower case characters are displayed intact here.
  149.     The block is always ended with "END" in the first column
  150.     after the text finishes.
  151. end
  152.     goto -scroll
  153. -line603 call -header | begtype
  154.  
  155. The easiest way to add color to menus is to first use the COLORCHAR command
  156. to make a character represent a color change. Then, every time that character
  157. is used within the BEGTYPE block, future text will be highlighted with
  158. the new color. A space will be added where each color change occurs.
  159. This technique is useful for both BEGTYPE and TYPE commands.
  160.  
  161.     BAT * BEGTYPE color sample ...
  162.     ColorChar @ as Color(Yellow)
  163.     BEGTYPE
  164.     @This@is highlighted
  165.     End
  166.     Type "So is@this!@"
  167.  
  168. and after running the EBL program we see...
  169.  
  170.      ~This~is highlighted
  171.      So is~this!~
  172. end
  173.     goto -scroll
  174. -line699 %i = 604
  175. -line604 call -header | begtype
  176.  
  177.   There is an additional advantage to using BEGTYPE command.  This command
  178. can also highlight text to the user.  This is done by using the form:
  179. [\\hex] within the text block.
  180.  
  181.   For example if the text block contained \\0F within the text, the result
  182. would be ~ High Intensity Text !  ~.
  183.  
  184.   By choosing different values, the screen attributes can be controlled to
  185. create inverted video, blinking, underlined, and very colorful text.
  186.  
  187.   You can also display the contents of variables by using [\\%Var.name] in
  188. the text block. For instance, if the variable %0 is to be printed, use \\%0
  189. within the text after the BEGTYPE command.
  190.  
  191.   An additional command CLS can be used to clear the display before
  192. printing data.    For instance, the combination "BAT CLS BEGTYPE" is quite
  193. useful for printing menus and text such as this screen.
  194. end
  195.     goto -scroll
  196. -line604
  197.     begtype
  198.  
  199.     ~NOW IT'S YOUR TURN !!!~
  200.  
  201.  
  202. If the ~%4~ variable contains the word ~DAY~, what is the command to display
  203. the words "~FUN DAY~" on the display?
  204.  
  205. end
  206.      %A = "TYPE FUN %4" | Call -tryit
  207. -opt7
  208. -line605  %i = 700
  209. -line700 %H = "Reading things from user" | call -header | begtype
  210.   In order to get input from the user, there are two available commands,
  211. READ and INKEY.
  212.  
  213.   When the command word READ is seen in the batch file, an input line is
  214. accepted from the user.  All function keys are assigned to the normal DOS
  215. edit functions.  When ENTER is pressed, the input line is assigned to DOS
  216. variables.
  217.  
  218.   Each word will be assigned in order to the variables indicated after the
  219. READ command.  When there are no more variables after the READ command to
  220. assign, the remainder of the response is thrown away.  If there are more
  221. variables to be assigned after the READ command than there are words from
  222. the user, these variables will be cleared out to a empty state.  For
  223. example:
  224.  
  225.     READ Please enter your name ==> %1 %2
  226.  
  227.   This would prompt the user and wait for him to enter two words.  These
  228. words will be saved in the %1 and %2 variables.
  229. end
  230.      goto -scroll
  231. -line701 call -header | begtype
  232.  
  233.   Note that there does not have to be any variables indicated after the
  234. command READ.  In this case, EBL would wait for the enter key, throw away
  235. any response, then continue to process the next batch file command.
  236.  
  237. end
  238.     goto -scroll
  239. -line702 call -header | begtype
  240.  
  241.   In the event that you wish to get a single keystroke from the user, the
  242. INKEY command should be used.
  243.  
  244.   This command will wait for the user to enter a single key on the keyboard
  245. and return its value in the optional variable.    This key can be not